package com.sservice.commonBusiness.service.impl;

import com.sservice.base.entity.dto.ListResult;
import com.sservice.base.entity.dto.Pagination;
import com.sservice.commonBusiness.e.Comment;
import com.sservice.commonBusiness.mapper.CommentMapper;
import com.sservice.commonBusiness.service.CommentService;
import com.sservice.commonBusiness.vo.CommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by byte_su@163.com on 2018/01/12.
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;


    @Override
    public List<CommentVo> queryByPage(CommentVo commentVo) {
        return commentMapper.queryByPage(commentVo);
    }

    @Override
    public ListResult userComment(CommentVo commentVo) {
        ListResult listResult = new ListResult(true, commentMapper.queryByPage(commentVo));
        listResult.setPage(new Pagination(commentVo.getPage(), commentMapper.countByPage(commentVo), commentVo.getSize()));
        return listResult;
    }

    @Override
    public int countByPage(CommentVo commentVo) {
        return commentMapper.countByPage(commentVo);
    }

    @Override
    public List<CommentVo> page(CommentVo commentVo) {
        return commentMapper.page(commentVo);
    }

    @Override
    public Integer pageCount(CommentVo commentVo) {
        return null;
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return commentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<CommentVo> selectByPrimaryKeyid(CommentVo commentVo) {
        return commentMapper.selectByPrimaryKeyid(commentVo);
    }


    @Override
    public int insert(Comment record) {
        return 0;
    }

    @Override
    public int insertSelective(Comment record) {
        return commentMapper.insertSelective(record);
    }

    @Override
    public Comment selectByPrimaryKey(Integer id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(Comment record) {
        return commentMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Comment record) {
        return 0;
    }
}
